﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Newtonsoft.Json.Linq;

namespace MusicSearch
{
    public partial class FormDetail : Form
    {
        private JObject music;
        public FormDetail(JObject music)
        {
            InitializeComponent();
            this.music = music;
            bind();
        }

        private void bind()
        {
            this.Text = (string)music["songName"];
            this.textBox_songname.Text = (string)music["songName"];
            this.textBox_artistname.Text = (string)music["artistName"];
            this.textBox_albumname.Text = (string)music["albumName"];
            this.textBox_lrc.Text = (string)music["lrcLink"];
            this.textBox_mp3.Text = (string)music["songLink"];
            this.textBox_all.Text = music.ToString();
        }

        private void textBox_lrc_DoubleClick(object sender, EventArgs e)
        {
            if (this.textBox_lrc.Text.Length > 0)
            {
                System.Diagnostics.Process.Start(this.textBox_lrc.Text);
            }
        }

        private void textBox_mp3_DoubleClick(object sender, EventArgs e)
        {
            if (this.textBox_mp3.Text.Length > 0)
            {
                System.Diagnostics.Process.Start(this.textBox_mp3.Text);
            }
        }

        private void textBox_songname_DoubleClick(object sender, EventArgs e)
        {
            new FormPlayer(this.music).Show();
        }
    }
}
